//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Windows.Media.Media3D;

namespace OpenLS.Chart.UI
{
    class DiskTessellator
    {
        
        public static IEnumerable<Point3D> GetPoints (double value, Bounds categoryBounds, Bounds  zBounds, int sign, int sliceCount, BarDirection direction)
        {
            double tethaDelta = AngleHelper.DegreeToRadian(360) / sliceCount;
            yield return CreatePoint(value, categoryBounds.Mid, zBounds.Mid, direction);
            for (int i = 0; i <= sliceCount; i++)
                yield return CreatePoint(value, categoryBounds.Mid + categoryBounds.Delta / 2 * Math.Cos(tethaDelta * i * sign), 
                    zBounds.Mid - zBounds.Delta / 2 * Math.Sin(tethaDelta * i * sign), direction);
        }
        static Point3D CreatePoint (double value, double category, double z, BarDirection direction)
        {
            switch (direction)
            {
                case BarDirection.Column:
                    return new Point3D(category, value, z);
                    default:
                    return new Point3D(value, category, z);

            }
        }
    }
}
